import { createRouter, createWebHistory } from 'vue-router'
import Cookie from 'js-cookie'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/home/home.vue'),
      meta: {
        title: 'QUAD FILM - Wholesale Car Wraps and Paint Protection Films Supplier',
        content: {
          keywords: "car wrap manufacturers, custom wraps for cars, PPF car, colored PPF, window tint film, car paint protection film",
          description: ' Discover QUAD FILM’s high-quality custom car wraps and paint protection films. As a leading car wrap supplier, we provide wholesale PPF solutions for bulk buyers. Contact us now for custom wrap and window film options.'
        }
      }
    }, {
      path: '/store',
      name: 'store',
      component: () => import('@/views/store/index.vue'),
      meta: {
        title: 'QUAD FILM Store - Buy Car Wraps and Paint Protection Films in Bulk',
        content: {
          keywords: "car wrap supplier, PPF wrap, color PPF film, reflective window film, privacy window film",
          description: 'Shop premium car wraps, colored PPF, and window tint films at wholesale prices from QUAD FILM. Get bulk discounts on high-quality paint protection films and car wrap solutions.'
        }
      }
    }, {
      path: '/companyProfile',
      name: 'companyProfile',
      component: () => import('@/views/companyProfile/index.vue'),
      meta: {
        title: 'About QUAD FILM - Leading Car Wrap and PPF Manufacturer',
        content: {
          keywords: "car wrap manufacturers, auto paint protection film, car PPF, window tint film, sunroof film manufacturer",
          description: 'QUAD FILM is a global leader in car wrap manufacturing and PPF production. We offer high-performance, eco-friendly protection films for automotive and architectural applications.'
        }
      }
    },
    {
      path: '/product/paint-protection-film-PPF',
      name: 'paint-protection-film-PPF',
      component: () => import('@/views/product/index.vue'),
    }, {
      path: '/product/color-paint-protection-film-PPF',
      name: 'color-paint-protection-film-PPF',
      component: () => import('@/views/product/index.vue'),
    }, {
      path: '/product/window-film',
      name: 'window-film',
      component: () => import('@/views/product/index.vue'),
    }, {
      path: '/product/sunroof-film',
      name: 'sunroof-film',
      component: () => import('@/views/product/index.vue'),
    }, {
      path: '/product',
      name: 'product',
      component: () => import('@/views/product/index.vue'),
      meta: {
        title: 'QUAD FILM - Wholesale Paint Protection Films and Car Wrap Solutions',
        content: {
          keywords: "custom wraps on cars, car wrap vinyl suppliers, PPF car, color PPF, paint protection film cost, blackout window film",
          description: 'Shop premium car wraps, colored PPF, and window tint films at wholesale prices from QUAD FILM. Get bulk discounts on high-quality paint protection films and car wrap solutions.'
        }
      }
    },
    {
      path: '/caseDetils/paint-protection-film-PPF',
      name: 'caseDetils-paint-protection-film-PPF',
      component: () => import('@/views/caseDetils/index.vue'),
    }, {
      path: '/caseDetils/color-paint-protection-film-PPF',
      name: 'caseDetils-color-paint-protection-film-PPF',
      component: () => import('@/views/caseDetils/index.vue'),
    }, {
      path: '/caseDetils/window-film',
      name: 'caseDetils-window-film',
      component: () => import('@/views/caseDetils/index.vue'),
    }, {
      path: '/caseDetils/sunroof-film',
      name: 'caseDetils-sunroof-film',
      component: () => import('@/views/caseDetils/index.vue'),
    }, {
      path: '/news',
      name: 'news',
      component: () => import('@/views/news/index.vue'),
      meta: {
        title: 'QUAD FILM News - Latest Updates on Car Wraps and PPF Technology',
        content: {
          keywords: "custom car wrap colors, car paint protection film, matte PPF, sunroof film supplier, window insulation film",
          description: 'Stay updated with QUAD FILM’s innovations in custom car wrap colors, PPF technology, and window tint films. Explore the latest trends in the paint protection and car wrap industry.'
        }
      }
    }, {
      path: '/newDetils',
      name: 'newDetils',
      component: () => import('@/views/newDetils/index.vue'),
    }, {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
    }, {
      path: '/my',
      name: 'my',
      component: () => import('@/views/my/index.vue'),
    }, {
      path: '/contactUs',
      name: 'contactUs',
      component: () => import('@/views/contactUs/index.vue'),
      meta: {
        title: 'Contact QUAD FILM - Get Wholesale Pricing on Car Wraps & PPF',
        content: {
          keywords: "car wrap supplier, car wrap manufacturers, PPF car wrap, paint protection film cost, window privacy film",
          description: 'Looking for bulk orders on car wraps, PPF films, and window tints? Contact QUAD FILM for custom solutions and competitive wholesale pricing on high-quality films.'
        }
      }
    }, {
      path: '/Warranty',
      name: 'Warranty',
      component: () => import('@/views/Warranty/index.vue'),
    }, {
      path: '/WarrantyAdd',
      name: 'WarrantyAdd',
      component: () => import('@/views/WarrantyAdd/index.vue'),
    }, {
      path: '/storeMy',
      name: 'storeMy',
      component: () => import('@/views/storeMy/index.vue'),
    }, {
      path: '/register',
      name: 'register',
      component: () => import('@/views/login/components/register.vue'),
    }, {
      path: '/storeRegister',
      name: 'storeRegister',
      component: () => import('@/views/login/components/storeRegister.vue'),
    }, {
      path: '/WarrantySerach',
      name: 'WarrantySerach',
      component: () => import('@/views/WarrantySerach/WarrantySerach.vue'),
    }, {
      path: '/userChangePassword',
      name: 'userChangePassword',
      component: () => import('@/views/login/components/userChangePassword.vue'),
    }, {
      path: '/storeChangePassword',
      name: 'storeChangePassword',
      component: () => import('@/views/login/components/storeChangePassword.vue'),
    }, {
      path: '/WarrantyChange',
      name: 'WarrantyChange',
      component: () => import('@/views/WarrantyChange/index.vue'),
    },

  ]
})
router.beforeEach((to, from) => {
  if (to.meta.content) {
    const head = document.getElementsByTagName('head')
    const meta = document.createElement('meta')
    document.querySelector('meta[name="keywords"]').setAttribute('content', to.meta.content.keywords)

    document.querySelector('meta[name="description"]').setAttribute('content', to.meta.content.description)

    meta.content = to.meta.content

    head[0].appendChild(meta)

  }

  // 路由发生变化修改页面title

  if (to.meta.title) {

    document.title = to.meta.title
  }
})
export default router